//获取应用实例
const app = getApp()
 
Page({
  data: {
    showPayPwdInput: false,  //是否展示密码输入层
    pwdVal: '',  //输入的密码
    payFocus: true, //文本框焦点
  },
  onLoad(options) {
    console.log(options.sum),
    this.setData({payMoney:options.sum}),
    this.showInputLayer();
  },
  /**
   * 显示支付密码输入层
   */
  showInputLayer(){
    this.setData({ showPayPwdInput: true, payFocus: true });
  },
  /**
   * 隐藏支付密码输入层
   */
  hidePayLayer(){
	/**在这调用支付接口**/
    this.setData({ showPayPwdInput: false, payFocus: false, pwdVal: '' }, function(){
      /**弹框**/
      wx.showToast({
        title: "支付成功",
      })
    });
 
  },
  /**
   * 获取焦点
   */
  getFocus(){
    this.setData({ payFocus: true });
  },
  /**
   * 输入密码监听
   */
  inputPwd(e){
      this.setData({ pwdVal: e.detail.value });
 
      if (e.detail.value.length >= 6){
        this.hidePayLayer();
      }
  }
})